<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" session="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
    <title>社区详情</title>

    <link href="${pageContext.request.contextPath}/static/css/common.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/font-awesome-4.3.0/css/font-awesome.min.css"
          rel="stylesheet">
    <!-- jqgrid-->
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/custom.ui.jqgrid.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/style.css" rel="stylesheet">
	<link href="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/css/select2.min.css"
          rel="stylesheet">
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/jquery.form.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/common.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/i18n/grid.locale-cn.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/minified/jquery.jqGrid.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/layer/layer.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/static/js/global.js"></script>
	<script src="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/js/select2.min.js"></script>
	<script type="text/javascript"
            src="${pageContext.request.contextPath}/static/plugins/My97DatePicker/WdatePicker.js"></script>

    <style type="text/css">
        .main h5 a {
            position: absolute;
            right: 20px;
            font-size: 14px;
            bottom: 0px;
            display: inline-block;
            padding: 5px;
        }

        .table_list tbody tr {
            height: 35px;
            text-align: center;
        }
        .box4{
        	position: relative;
        	top: 5px;
			margin-left:800px;
        	text-align: center;
		    font-size: 15px !important;
		    width: 90px;
		    height: 34px;
		    -webkit-border-radius: 15px;
		    -moz-border-radius: 15px !important;
		    background: #F5F5F6;
		    color: black !important;
		    border: 1px solid #AFAAAA;
		    margin-bottom: 10px;
		    background-color: #4BC5C3 !important;
		    border-color: #1AA3A5 !important;
		    color: #FFF !important;
        }
		.panel{
			*+margin-left:270px;
		}
		 .left ul li{
			
			*line-height:40px;
			*background:#484848;
			*padding-left:20px;
		}
		
		.left ul li a, .left ul li a:hover{
			*color:#fff;
		}
    </style>
</head>
<body view="menu-item-4142">
<jsp:include page="../../top.jsp"></jsp:include>
<div class="right">
    <div class="jqGrid_wrapper" style="position: absolute;top:100px;*+left:320px;*+top:120px">
            <input name="report" id="report" type="hidden" class="box4" type="button" value="运营数据" onclick="query()">
        <table id="jqGrid"></table>
	    </div>
</div>
<script>
    $(document).ready(
            function () {
            	$.ajax({
	                 type: "POST",
	                 async: false,
	                 url: '/admin/auth_buttons.action',
	                 data: "url=" + window.location.pathname,
	                 success: function (data) {
	                     data = eval("(" + data + ")");
	                     for (var i in data) {
	                         var action = data[i].mName;
	                         switch (action) {
	                             case "社区修改":
	                                 $("#report").after("<input style=\"width: 134px;\" class=\"box4\" type=\"button\" value=\"编辑社区信息\" onclick=\"edit()\">");
	                                 break;
	                         }
	                     }
	                 }
	             });
                $.jgrid.defaults.styleUI = "Bootstrap";
                var array=new Array();
                for(var i=1;i<7;i++){
                 array[i] =GetDateStr(-i);
                }
                	
                $("#jqGrid").jqGrid(
                        {
                        	url: "${pageContext.request.contextPath}/admin/tcommunity_tcomuReports.action?tCommunityId=${tCommunityId}",
                         	mtype: 'POST',
                            datatype: "json",
                            height: 510,
                            autowidth: false,
                            shrinkToFit: false,
                            rowNum: 15,
                            rowList: [10, 20, 30],
                            colNames: ['掌连运营数据', '全部', '今日', array[1], array[2], array[3], array[4],
                                       array[5], array[6], '近30日' ,'本季度'],
                            colModel: [{
                                name: 'CNAME',
                                index: 'CNAME',
                                sortable:false,
                                width: 100
                            },{
                                name: 'COUNTNUM',
                                index: 'COUNTNUM',
                                sortable:false,
                                width: 90
                            }, {
                                name: 'A',
                                index: 'A',
                                sortable:false,
                                width: 90
                            },{
                                name: 'B',
                                index: 'B',
                                sortable:false,
                                width: 90
                            },{
                                name: 'C',
                                index: 'C',
                                sortable:false,
                                width: 90
                            }, {
                            	name: 'D',
                                index: 'D',
                                sortable:false,
                                width: 90
                            }, {
                            	name: 'E',
                                index: 'E',
                                sortable:false,
                                width: 90
                            }, {
                            	name: 'F',
                                index: 'F',
                                sortable:false,
                                width: 90
                            }, {
                            	name: 'G',
                                index: 'G',
                                sortable:false,
                                width: 90
                            }, {
                            	name: 'H',
                                index: 'H',
                                sortable:false,
                                width: 90
                            }, {
                            	name: 'I',
                                index: 'I',
                                sortable:false,
                                width: 90
                            }],
                            rownumbers: false,
                            jsonReader: {
                                root: 'rows',
                                page: "page",
                                total: 'total',
                                records: "records",
                                repeatitems: false
                            },
                            pager: "#jqGrid_paper",
                            viewrecords: false,
                            multiselect: false,
                            hidegrid: false
                        });
                var mydata=[
							{CNAME:'住户',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'开门广告点击',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'首屏广告点击',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'订单数',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'订单金额',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'发帖',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'评论',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'点赞',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'乐享动态',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'门禁安装',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'钥匙数',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'开门记录',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'信誉分',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''}
						];
						for(var i=0; i<mydata.length; i++)  //循环给每行添加数据
						{
							$("#jqGrid").jqGrid('addRowData',i+1,mydata[i]);
						}
            });
	function query() {
        $("#jqGrid").jqGrid('setGridParam',{
			url : "${pageContext.request.contextPath}/admin/tcommunity_tcomuReports.action?tCommunityId=${tCommunityId}",
			page : 1
		}).trigger("reloadGrid"); //重新载入 .
    }

	function edit(){
		if('${tCommunityId}'==''){
            alert("社区编码为空，请从公司列表进入！");
            return;
        }
    	layer.open({
            type: 2,
            title: '<strong>修改社区信息</strong>',
            shadeClose: true, //点击遮罩关闭层
            area: ['800px', '630px'],
            content: '${pageContext.request.contextPath}/admin/tcommunity_editView.action?sid=${tCommunityId}',
            btn: ['提交', '取消'],
            yes: function (index, layero) {
                var options = {
                    success: function (data) {
                        data = JSON.parse(data);
                        if (data.code == 1) {
                            layer.alert(data.msg, function () {
                                layer.closeAll();
                            });
                        } else {
                            layer.alert(data.msg);
                        }
                        refreshGrid();
                    }
                };
                $("#layui-layer-iframe" + index).contents().find("#form").ajaxForm(options);
                $("#layui-layer-iframe" + index).contents().find("#form").submit();
            }
    	})
    };
	window.onload=function(){
		function BrowserType(){
			//获取浏览器的userAgent代理号；
			var userAgent=navigator.userAgent;
			
			//判断是否是Opera浏览器
			var isOpera=userAgent.indexOf("Opera")>-1;
			//判断是否是IE浏览器
			var isIE=userAgent.indexOf("compatible")>-1 && userAgent.indexOf("MSIE")>-1 && !isOpera;
			//判断是否是IE7浏览器
			if(isIE){
				var relIE=new RegExp("MSIE(\\d+\\.\\d+);");
				
				relIE.test(userAgent);
				var arr=userAgent.split(";")
				var flEVersion=arr[1].indexOf("7");
				if(flEVersion>-1){
					$tr=$("thead tr th");
					$td=$("tbody tr td");
					var len=$tr.length;
					for(var i=0;i<len;i++){
						$tr[i].style.width=10+"px";
						$td[i].style.width=10+"px";
					};
				}
			}
		};
		BrowserType();
	};
</script>
</body>
</html>
